Edge properties like weight and direction encode important rules and costs.

  • In a road map, edges can be weighted to represent distance or travel time. Most roads are two-way, making the graph undirected, but one-way streets require directed edges.
  • For course prerequisites, directed edges are essential. They encode a "must take before" relationship, forming a structure that is typically a DAG (Directed Acyclic Graph), meaning it contains no circular dependencies.
  • The key takeaway is that edge direction and weights are powerful modeling choices. They allow a simple graph structure to encode complex rules, costs, and constraints found in real-world problems.